package 每日一题;

import java.util.Deque;
import java.util.LinkedList;
import java.util.Stack;

public class 括号的最大嵌套深度 {
    public int maxDepth(String s) {
        char[] chars = s.toCharArray();
        Stack stack = new Stack();
        int max = 0;
        for (int i = 0; i < chars.length; i++) {
            if (chars[i]=='(')
                stack.push("(");
            max = Math.max(stack.size(),max);
            if (chars[i]==')')
                stack.pop();
        }
        return max;
    }
}
